The present invention generally relates to presentation of colors. More particularly, the present invention relates to ensuring adequate contrast between colors used in graphical user interface elements.
In recent years, the use of graphical user interfaces for the display of information on computer monitors has increased dramatically. With that increase, developers of computer operating systems and computer software applications have sought to implement a variety of color schemes for the presentation of computer rendered information that will be pleasing to the user, avoid user fatigue, such as eye strain, and that allow the user to quickly find and utilize graphically displayed functional elements, such as buttons, toolbars and control boxes.
In deciding appropriate colors for use for rendering graphical user interface elements such as buttons, toolbars and control boxes, software developers often must select pairings of colors that will be displayed adjacent to each other as adjacent graphical user interface elements. For example, a developer of a word processing application may desire to place certain button text against a button background on a tool bar located above a text entry area. In order to make the button text useful to the user, it is desirable that the button text be colored such that a sufficient amount of contrast exists between the color of the button text and the color of the button background. Only with sufficient contrast will the user be able to readily distinguish the button text from the background color of the button. If the contrast between the button text and the button background is insufficient, the user may not readily read the button. Also, the user may develop fatigue from trying to read the button text, or the user may simply be annoyed at the lack of sufficient contrast between the button text and the button background.
Other exemplary contrast issues include maintaining sufficient contrast between the text of a disabled button and the background color of the button in which the text is located such that on the one hand the user may readily determine that the button is disabled, and on the other hand the text of the button does not wash out from view of the user.
Systems have been developed in which standard sets of colors are preset at the operating system level and software application level to ensure that an adequate degree of contrast between those sets of colors exist. However, such systems do not account for the desires of developers and users to modify individual colors without adversely affecting the contrast between that color and any other colors in the set. And, manually adjusting one color relative to another color often adversely affects the hues of the color. For example, adjusting the color blue may make the color blue appear purple.
It is with respect to these considerations and others that the present invention has been made.
In accordance with the present invention, the above and other problems are solved by a method and system for ensuring adequate contrast between the colors used for displaying graphical user interfaces. Pairs of colors for use in graphical user interface elements are compared to determine whether a minimum required contrast exists between the colors. If a determination is made that the contrast between a given pair of colors is less than the minimum required contrast, one of the colors is designated as locked and the other color is designated as moveable.
The moveable color is moved toward white or black to increase the relative contrast between the moveable color and the locked color. Once the required minimum contrast is met or exceeded, the color pairing may be used for rendering graphical user interface elements. Once adequate contrast is achieved, the colors of the two graphical user interfaces thus compared are locked from subsequent change when fixing contrast between one of those elements and a third element.
More particularly, a determination is made whether the contrast between the first color and the second color of a pair of graphical user interface elements is equal to or greater than the minimum contrast, and if the contrast is not equal to or greater than the minimum contrast, the first color is designated as locked, and the second color is designated as moveable. If the moveable color is closer to the color black than the locked color, the moveable color is moved closer to the color black until the contrast between the first color and the second color is equal to or greater than the minimum contrast. However, if the moveable color is closer to the color white than the locked color, the moveable color is moved closer to the color white until the contrast between the first color and the second color is equal to or greater than the minimum contrast. Once a pair of colors has been processed neither color of that pair may be moved in the future, and both must be considered locked for any future calculations.
According to another aspect, a maximum contrast is set for the first color and the second color. A determination is made whether the contrast between the first color and the second color exceeds the maximum contrast. If the contrast between the first color and second color exceeds the maximum contrast, the first color is designated as locked and the second color is designated as moveable. The moveable color is moved closer to the locked color until the contrast between the locked color and moveable color is less than or equal to the maximum contrast.
Alternatively, a computer readable medium is provided which stores computer executable instructions which when executed by a computer ensure adequate contrast between colors of graphical user interfaces as described above.
These methods may be implemented as a computer process, a computing system or as an article of manufacture such as a computer program product or computer readable media. The computer program product may be a computer storage media readable by a computer system and encoding a computer program of instructions for executing a computer process. The computer program product may also be a propagated signal on a carrier readable by a computing system and encoding a computer program of instructions for executing a computer process.
These and other features and advantages, which characterize the present invention, will be apparent from a reading of the following detailed description and a review of the associated drawings. It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed.